package com.wzh.design.combination.bag1;

/**
 * @description:  组合模式
 * @author: WZH
 * @time: 2021/12/24 10:07
 */


//菜单项
public class Item extends Component {
    private String name;
    private float price;

    public Item(String name, float price) {
        this.name = name;
        this.price = price;
    }

    @Override
    public String getName() {
        return name;
    }

    @Override
    public float getPrice() {
        return price;
    }

    @Override
    public void print(int offset) {
        super.printOffsed(offset);
        System.out.println("[商品名=" + name + ", 价格=" + price + "]");
    }
}
